<%--
  Created by IntelliJ IDEA.
  User: 22954
  Date: 2024/10/30
  Time: 21:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Rest</title>
    <script src="../script/jquery-3.7.1.min.js"></script>
    <script>
        $(function () {
            $("#deleteBook").click(function () {
                var $hiddenForm = $("#hiddenForm");
                $hiddenForm.attr("action", this.href);
                $hiddenForm.children("input:hidden").val("DELETE");
                $hiddenForm.submit();
                return false;
            })
        })
    </script>
</head>
<body>
<h1>Rest风格CRUD操作</h1>
<br/><br/>
<hr/>
<h2>rest风格url 查询书籍</h2>
<a href="../book/retrieve/11">点击查询书籍</a>
<hr/>
<h2>rest风格url 添加书籍</h2>
<form action="../book/create" method="post">
    name: <input type="text" name="name"><br/><br/>
    <input type="submit" value="添加书籍">
</form>
<hr/>
<h2>rest风格url 删除书籍</h2>
<a href="../book/delete/22" id="deleteBook">删除id的书籍</a>
<form method="post" id="hiddenForm">
    <input type="hidden" name="_method">
</form>
<hr/>
<h2>rest风格url 修改书籍</h2>
<form action="../book/update/33" method="post">
    <input type="hidden" name="_method" value="PUT">
    <input type="submit" value="修改书籍">
</form>
</body>
</html>
